<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-03 00:33:05
 * @LastEditTime: 2023-10-15 17:21:36
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description: BOM成品工艺
 */

namespace App\Models;

use App\Traits\AttachmentTrait;
use App\Traits\MaterialTrait;
use App\Traits\StorageTrait;

class ProOutsourcingProduct extends BaseModel
    {
    use AttachmentTrait;
    use MaterialTrait;
    use StorageTrait;
    public $timestamps = true;
    public $table = "sys_pro_outsourcing_product";
    protected $guarded = [];

    public function details()
        {
        return $this->hasMany(ProOutsourcingProductDetail::class, "main_id");
        }

    public function outfactory()
        {
        return $this->belongsTo(Company::class);
        }

    public function raws()
        {
        return $this->HasMany(ProOutsourcingProductRaw::class, "main_id");
        }
    public function plan()
        {
        return $this->belongsTo(ProOutsourcingPlan::class, "code", "code");
        }
    public function finish()
        {
        return $this->belongsTo(ProOutsourcingFinish::class, "finish_code", "code");
        }
    }
